package com.touchalachs.core;

import java.text.DecimalFormat;

public class StringTool {

	public static String format(double value, int decimals) {
		String pattern = "###,###";
		for (int i=0; i<decimals; i++){
			if (i==0){
				pattern += ".";
			}
			pattern += "#";
		}
		DecimalFormat myFormatter = new DecimalFormat(pattern);
		return myFormatter.format(value);
	}

	public static String format(long value) {
		DecimalFormat myFormatter = new DecimalFormat("###,###");
		return myFormatter.format(value);
	}
}
